import request from "@/utils/request.js";
import {clientBaseURL} from "@/utils/request.js"

export const userLoginAPI = (loginData) => {
    return request.post('/user/login', loginData)
}

// 使用手机号登录
export const userLoginByCodeAPI = (loginData) => {
    return request.post('/user/loginByCode', loginData)
}

export const userRegisterAPI = (registerData) => {
    return request.post('/user/register', registerData)
}

export const userGetInfoAPI = ()=>{
    return request.get("/user/getInfo")
}

// 获取验证码
export const getCodeAPI = (phone)=>{
    return request.get(`/user/getCode?phone=${phone}`)
}

export const userGetEnemyAPI = (enemyName)=>{
    return request.get("/user/getEnemy", {
        params: {
            enemyName
        }
    })
}

// 修改用户信息updateUserInfo
export const updateUserInfoAPI = (data) => {
    return request.post('/user/updateUserInfo', data)
}

export const updateAvatarAPI = (id)=>{
    return `${clientBaseURL}/api/user/updateAvatar?id=${id}`
}

// 修改密码
export const updatePwdAPI = (data)=>{
    return request.post('/user/updatePwd',data)
}